<template>
  <div>
    <h1>emit</h1>
    <button @click="chuangdi">传递</button>
    <hr />
    <BrotherJack />
    <BrotherTom />
    <BrotherRose />
  </div>
</template>

<script>
import BrotherJack from "./BrotherCom/BrotherJack";
import BrotherTom from "./BrotherCom/BrotherTom";
import BrotherRose from "./BrotherCom/BrotherRose";

export default {
  name: "",
  props: [""],
  data() {
    return {
      num: 1
    };
  },

  components: {
    BrotherJack,
    BrotherTom,
    BrotherRose
  },

  computed: {},

  beforeMount() {},

  mounted() {
    this.$eventBus.$on("testProto", num => {
      console.log(num);
    });
  },

  methods: {
    chuangdi() {
      //将this.num传递给其父组件APP
      // 触发、分布 参数1 事件名  参数二 传递的数据
      this.$emit("emitNum", this.num);
    }
  },

  watch: {}
};
</script>
<style lang='' scoped>
</style>